/*
 * Copyright (c) 2009 Nokia Corporation.
 */

#include <QApplication>
#include <QPalette>
#include <QLCDNumber>
#include <QSpinBox>
#include <QListWidget>
#include "QBaseWidget.h"
#include "SlidingStackedWidget.h"

QBaseWidget::QBaseWidget(QStackedWidget* stackedWidget, QWidget *parent) :
	QWidget(parent)
	{
	this->stackedWidget = stackedWidget;

	}

QBaseWidget::~QBaseWidget()
	{

	}

void QBaseWidget::ActivateWidget()
	{
	//call to concrete class method
	DoActivateWidget();
	}

void QBaseWidget::DeActivateWidget()
	{
	//call to concrete class method
	DoDeActivateWidget();
	}

/////////////////////////////////////////////////////////////////////////////////////
// ---------------------------------------------------------------------------
// QMyWidget3
//
QMyWidget3::QMyWidget3(QStackedWidget* stackedWidget, QWidget *parent) :
	QBaseWidget(stackedWidget, parent), b11(0), b12(0), slideWidget1layout(0),
			slideWidget1(0)
	{

	}

QMyWidget3::~QMyWidget3()
	{

	}

void QMyWidget3::DoActivateWidget()
	{

	slideWidget1 = new QWidget(this);
	QVBoxLayout *slideWidget1layout = new QVBoxLayout(slideWidget1);
	slideWidget1->setLayout(slideWidget1layout);
	b11 = new QPushButton("Cool", slideWidget1);
	slideWidget1layout->addWidget(b11);
	b12 = new QPushButton("is Qt !", slideWidget1);
	slideWidget1layout->addWidget(b12);
	slideWidget1->show();

	}

void QMyWidget3::DoDeActivateWidget()
	{
	if (slideWidget1)
		{
		delete slideWidget1;
		slideWidget1 = NULL;
		}
	}

TWidgetId QMyWidget3::Id() const
	{
	return KViewId3;
	}

/////////////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////////////
// ---------------------------------------------------------------------------
// QMyWidget4
//
QMyWidget4::QMyWidget4(QStackedWidget* stackedWidget, QWidget *parent) :
	QBaseWidget(stackedWidget, parent), b21(0), b22(0), slideWidget2layout(0),
			slideWidget2(0)
	{

	}

QMyWidget4::~QMyWidget4()
	{

	}

void QMyWidget4::DoActivateWidget()
	{

	slideWidget2 = new QWidget(this);
	QVBoxLayout *slideWidget2layout = new QVBoxLayout(slideWidget2);
	slideWidget2->setLayout(slideWidget2layout);
	QLCDNumber* lcd = new QLCDNumber(slideWidget2);
	//lcd->setBackgroundRole(QPalette::NColorRoles);
	lcd->setFixedHeight(100);
	lcd->setFrameStyle(3);
	QSpinBox* spin;
	spin = new QSpinBox(slideWidget2);
	slideWidget2layout->addWidget(lcd, Qt::AlignHCenter);
	slideWidget2layout->addWidget(spin, Qt::AlignHCenter);
	slideWidget2->show();

	}

void QMyWidget4::DoDeActivateWidget()
	{
	if (slideWidget2)
		{
		delete slideWidget2;
		slideWidget2 = NULL;
		}
	}

TWidgetId QMyWidget4::Id() const
	{
	return KViewId4;
	}

/////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////
// ---------------------------------------------------------------------------
// QMyWidget4
//
QMyWidget5::QMyWidget5(QStackedWidget* stackedWidget, QWidget *parent) :
	QBaseWidget(stackedWidget, parent), b31(0), b32(0), slideWidget3layout(0),
			slideWidget3(0)
	{

	}

QMyWidget5::~QMyWidget5()
	{

	}

void QMyWidget5::DoActivateWidget()
	{

	slideWidget3 = new QWidget(this);
	QVBoxLayout *slideWidget3layout = new QVBoxLayout(slideWidget3);
	slideWidget3->setLayout(slideWidget3layout);
	QLabel* qImgContainer1 = new QLabel(slideWidget3);
	qImgContainer1->setPixmap(QPixmap(":/qt-logo.png"));
	slideWidget3layout->addWidget(qImgContainer1);
	slideWidget3->show();

	}

void QMyWidget5::DoDeActivateWidget()
	{
	if (slideWidget3)
		{
		delete slideWidget3;
		slideWidget3 = NULL;
		}
	}

TWidgetId QMyWidget5::Id() const
	{
	return KViewId5;
	}
/////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////////////
// ---------------------------------------------------------------------------
// QMyWidget4
//
QMyWidget6::QMyWidget6(QStackedWidget* stackedWidget, QWidget *parent) :
	QBaseWidget(stackedWidget, parent), b41(0), b42(0), slideWidget4layout(0),
			slideWidget4(0)
	{

	}

QMyWidget6::~QMyWidget6()
	{

	}

void QMyWidget6::DoActivateWidget()
	{

	slideWidget4 = new QWidget(this);
	QVBoxLayout *slideWidget4layout = new QVBoxLayout(slideWidget4);
	slideWidget4->setLayout(slideWidget4layout);
	QListWidget *listWidget = new QListWidget(slideWidget4);
	listWidget->setSortingEnabled(1);
	//Refrencing Item to Listwidget    
	QListWidgetItem *lst1 = new QListWidgetItem("slide1", listWidget);
	QListWidgetItem *lst2 = new QListWidgetItem("slide2", listWidget);
	QListWidgetItem *lst3 = new QListWidgetItem("slide3", listWidget);

	listWidget->insertItem(1, lst1);//Item insertion   
	listWidget->insertItem(2, lst2);
	listWidget->insertItem(3, lst3);
	slideWidget4layout->addWidget(listWidget, Qt::AlignCenter);

	slideWidget4->show();

	}

void QMyWidget6::DoDeActivateWidget()
	{
	if (slideWidget4)
		{
		delete slideWidget4;
		slideWidget4 = NULL;
		}
	}

TWidgetId QMyWidget6::Id() const
	{
	return KViewId6;
	}
///////////////////////////////////////////////////////////////////////////////////
